<template>
  <div id="app">
    <router-view />
    <theme-picker />
  </div>
</template>

<script>
import ThemePicker from "@/components/ThemePicker";

export default {
  name: "App",
  components: { ThemePicker },
  created() {},
  mounted() {

    // //在页面加载时读取localStorage里的状态信息
    // if (localStorage.getItem("store")) {
    //   this.$store.replaceState(
    //     Object.assign(
    //       {},
    //       this.$store.state,
    //       JSON.parse(localStorage.getItem("store"))
    //     )
    //   );
    // }

    // //在页面刷新时将vuex里的信息保存到localStorage里
    // window.addEventListener("beforeunload", this.handler());

    let token = location.href.indexOf('token') != -1 ? location.href.split('token=')[1].split('#/')[0] : '';
        console.log(location.href, 'sssssssss', token)
        // // 单点登录
        if (token) {
          localStorage.setItem("token",token)
        }
  },
  methods: {
    handler() {
      localStorage.setItem("store", JSON.stringify(this.$store.state));
    },
  },
  // metaInfo() {
  //   return {
  //     title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
  //     titleTemplate: title => {
  //       return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
  //     }
  //   }
  // }
};
</script>
<style scoped>
#app .theme-picker {
  display: none;
}
</style>
